<template>
  <div class="header_bgi w_full h_50 lh_50 text_center bgs_full relative">
    <div 
      class="fs_26 fw_bold color_fff cursor font_zh_en" 
      @click="goToHomePage"
    >
      {{ headerName }}
    </div> 

    <div class="w_300 h_30 fs_20 color_fff absolute right_0 top_0 z_999 main_border">
      {{ current_time }}
    </div>
  </div>
</template>

<script>
  export default {
    name: 'BigScreenHeader',
    props: {
      headerName: ''
    },
    data() {
      return {
        current_time: null
      }
    },
    mounted() {
      this.current_time = this.curentTime()
    },
    methods: {
      // 跳转到 首页
      goToHomePage() {
        this.$router.push({
          path: "/"
        })
      },

      // 获取时间
      curentTime() {
        var now = new Date();

        var year = now.getFullYear();       //年
        var month = now.getMonth() + 1;     //月
        var day = now.getDate();            //日

        var hh = now.getHours();            //时
        var mm = now.getMinutes();          //分
        var ss = now.getSeconds();           //秒

        var clock = year + "-";

        if (month < 10)
          clock += "0";

        clock += month + "-";

        if (day < 10)
          clock += "0";

        clock += day + " ";

        if (hh < 10)
          clock += "0";

        clock += hh + ":";
        if (mm < 10) clock += '0';
        clock += mm + ":";

        if (ss < 10) clock += '0';
        clock += ss;

        return (clock);
      },
    }
  }
</script>

